import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: () => import('../views/Index'),
    //重定向
    redirect: '/index/home',
    children: [
      {
        //首页
        path: 'home',
        component: () => import('../views/Index/Home'),
      }
      ,
      {
        //看房
        path: 'lookhouse',
        component: () => import('../views/Index/Lookhouse'),
      }
      ,
      {
        //发布
        path: 'publish',
        component: () => import('../views/Index/Publish'),
      }
      ,
      {
        //消息
        path: 'news',
        component: () => import('../views/Index/News'),
      }
      ,
      {
        //我的
        path: 'my',
        component: () => import('../views/Index/My'),
      }
    ]
  },
  {
    //买房
    path: '/buyhouse',
    component: () => import('../views/Index/Home/Buyhouse'),
  }
  ,
  {
    //租房
    path: '/renting',
    component: () => import('../views/Index/Home/Renting'),
  }
  ,
  {
    //求租
    path: '/wanted',
    component: () => import('../views/Index/Home/Wanted'),
  }
  ,
  {
    //求购
    path: '/asktobuy',
    component: () => import('../views/Index/Home/Asktobuy'),
  }
  ,
  {
    //地图找房
    path: '/maproom',
    component: () => import('../views/Index/Home/Maproom'),
  }
  ,
  {
    //资讯
    path: '/information',
    component: () => import('../views/Index/Home/Information'),
  }
  ,
  {
    //楼市圈
    path: '/housingring',
    component: () => import('../views/Index/Home/Housingring'),
  }
  ,
  {
    //经纪人
    path: '/broker',
    component: () => import('../views/Index/Home/Broker'),
  }
  ,
  {
    //团购看房
    path: '/Grouplookroom',
    component: () => import('../views/Index/Home/Grouplookroom'),
  }
  ,
  {
    //直播看房
    path: '/livelookroom',
    component: () => import('../views/Index/Home/Livelookroom'),
  }
  ,
  {
    //详情
    path: '/detail/:id',
    component: () => import('../views/Detail'),
  }
  ,
  {
    //城市定位
    path: '/floor',
    component: () => import('../views/Index/Home/Floor'),
  }
  ,
  {
    //登录
    path: '/login',
    component: () => import('../views/Login'),
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
